<template>
  <div>
    <Toolbar
      style="border-bottom: 1px solid #ccc"
      :editor="editor"
      :defaultConfig="toolbarConfig"
      :mode="mode"
      class="barStyle"
    />
    <Editor
      style="height: 300px; overflow-y: hidden"
      v-model="infoData"
      :defaultConfig="editorConfig"
      :mode="mode"
      @onCreated="onCreated"
      class="editorStyle"
    />
  </div>
</template>
<script>
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'

export default {
  components: {
    Editor,
    Toolbar
  },
  data () {
    return {
      editor: '',
      mode: {},
      editorConfig: {
        //输入部分的富文本 配置项
        placeholder: '请输入内容...'
      },
      toolbarConfig: {
        //工具栏部分的配置项
        excludeKeys: ['uploadVideo', 'fullScreen', 'emotion', 'insertTable']
      },
      infoData: '' //富文本编辑器内容
    }
  },
  methods: {
    onCreated (editor) {
      this.editor = Object.seal(editor)
    }
  }
}
</script>

<style src="@wangeditor/editor/dist/css/style.css"></style>
